<?php
    function openDB(){
      $connect = mysql_connect("mysql服务器地址","mysq帐号","mysql密码");
      if (!$connect)
      {
        die('无法连接数据库: ' . mysql_error());
      }
      mysql_select_db("数据库名", $connect);
      mysql_query("set names 'utf8'");
      return $connect;
    }

    function query($sqlstring){
      return mysql_query($sqlstring);
    }

    function insert($sqlstring,$conn){
      return mysql_query($sqlstring,$conn);
    }

    function closeDB($conn){
      mysql_close($conn);
    }
?>
